package cn.huiyunche.admin.security;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;

import cn.huiyunche.base.service.framework.exception.AppError;
import cn.huiyunche.base.service.framework.utils.AppUtils;

/**
 * 认证失败处理.
 *
 * @author zhaoshb
 * @since 0.0.1
 */
public class JwtAuthenticationFailureHandler implements AuthenticationFailureHandler {

	public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
		AppUtils.responseErrorJson(response, AppError.UsermamePasswordInvlidError);
	}

}
